<?php
// Magento login information 
$mage_url = 'http://192.168.1.7/magento/api/?wsdl'; 
$mage_user = 'soap_user'; 
$mage_api_key = '111111'; 
// Initialize the SOAP client 
$soap = new SoapClient( $mage_url ); 
// Login to Magento 
$session_id = $soap->login( $mage_user, $mage_api_key );
echo $session_id;
echo "<br/>";
echo "<br/>";

$cid = $soap->call ($session_id, 'cart.create');
// echo $cid;
$arrProducts = array(
	array(
		"product_id" => "3",
		"qty" => 5
	)
);
$resultCartProductAdd = $soap->call($session_id, "cart_product.add", array($cid, $arrProducts));
// echo $resultCartProductAdd;

$resultShippingMethods = $soap->call($session_id, "cart_shipping.list", array($cid));
echo print_r( $resultShippingMethods );

// $allCategories = $soap->call( $session_id, 'catalog_category.tree');
// $children = $allCategories['children'];
// // echo print_r($allCategories['children']);
// $len_category = sizeof($children);
// //echo $len_category;
// for ($i = 1; $i < $len_category; $i++) {
	// echo "<br/>";
	// echo "<br/>";
	// $product[$i] = $soap->call( $session_id, 'catalog_category.assignedProducts', $children[$i]['category_id']);
	// echo $children[$i]['name'];
	// //echo print_r($product[$i]);
	// $len_product = sizeof($product[$i]);
	// for ($j = 0; $j < $len_product; $j++) {
		// echo "<br/>";
		// $p = $product[$i][$j];
		// $temp_product = $soap->call ($session_id, 'catalog_product.info', $p['product_id']);
		// // echo print_r($temp_product);
		// echo $temp_product['name'];
	// }
// } 
?>
<?
// Make the API-call
$resources = $soap->resources( $session_id );
?>
<?php if( is_array( $resources ) && !empty( $resources )) { ?> 
<?php foreach( $resources as $resource ) { ?> 
<h1><?php echo $resource['title']; ?></h1> 
Name: <?php echo $resource['name']; ?><br/>
Aliases: <?php echo implode( ',', $resource['aliases'] ); ?> 
<table> 
    <tr> 
        <th>Title</th> 
        <th>Path</th> 
        <th>Name</th> 
    </tr> 
    <?php foreach( $resource['methods'] as $method ) { ?> 
    <tr> 
        <td><?php echo $method['title']; ?></td> 
        <td><?php echo $method['path']; ?></td> 
        <td><?php echo $method['name']; ?></td> 
        <td><?php echo implode( ',', $method['aliases'] ); ?></td> 
    </tr> 
    <?php } ?> 
</table> 
<?php } ?> 
<?php } ?>